package conf

import (
	"github.com/go-kratos/kratos/v2/config"
	"github.com/go-kratos/kratos/v2/config/file"
)

type Bootstrap struct {
	Namespace string
	Name      string
	Register  string
	Http      *HTTP
	Params    *Params
}

type Params struct {
	ServiceHello string
}

func Load(path string) (*Bootstrap, error) {
	cfg := config.New(
		config.WithSource(
			file.NewSource(path),
		),
	)

	if err := cfg.Load(); err != nil {
		return nil, err
	}

	out := new(Bootstrap)
	err := cfg.Scan(out)

	return out, err
}

type HTTP struct {
	Address string
}
